class NewControllerTests extends GroovyTestCase {

	def controller

	def builder = new com.danilat.utils.test.TestContextBuilder()

	void testSomething(){
		builder.context ("A user"){
			setup{
				controller = new NewController()
			}
			
			def story = controller.create()
			assertNotNull story
			
			context ("save a new story"){
				setup{
					controller.params.title = "eurovision"
			        controller.params.content = "lalala"
			    	controller.save()
				}
				
		    	story = New.findByTitle("eurovision")
		    	assertNotNull story
		    	assertEquals "/new/show/{story.id}", controller.response.redirectedUrl
			}
	    	
		}
	}
}
